Rules for Tools/Note Events
Note Events
When Bars&Pipes stores a note in a sequence, it stores it as one Event, `MIDI_NOTEON',
rather than as a pair consisting of `MIDI_NOTEON' and `MIDI_NOTEOFF'. To facilitate
this, the NoteEvent structure is used in lieu of the Event structure:
struct NoteEvent {
struct NoteEvent *next;
long time;
char type;
unsigned char status;
unsigned char value;
unsigned char velocity;
unsigned short duration;
short data;
struct Tool *tool;
};
As you can see, this structure is almost identical to the Event structure. Since
this structure is designed to represent Note Events, rather than generic MIDI
information, value and velocity replace `byte1' and `byte2'. Notice that two shorts,
`duration' and `data', replace the long data. If an Event is a `MIDI_NOTEON' NoteEvent
and it is in a sequence (which is where a PadTool edits it,) `duration' holds the
length, in clocks, of the note. Notes in the PipeLine have separate `MIDI_NOTEON' and
`MIDI_NOTEOFF' events, and they are processed separately. If you write a Tool that
processes the note-off times of notes, make sure to check `EVENT_PADEDIT' to determine
whether you should look at the NoteEvent's duration field or at the time field of a
later `MIDI_NOTEOFF' NoteEvent to calculate the release time.